﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations;
using TinyPMS_Jerusalem.Models.Validation;
using System.Web.Mvc;

namespace TinyPMS_Jerusalem.ViewModels
{
    [PropertiesMustMatch("NewPassword", "ConfirmPassword", ErrorMessage = "新密码和确认密码不匹配。")]
    public class ChangePasswordModel
    {
        [Required]
        [DataType(DataType.Password)]
        [DisplayName("当前密码")]
        public string OldPassword { get; set; }

        [Required]
        [ValidatePasswordLength]
        [DataType(DataType.Password)]
        [DisplayName("新密码")]
        public string NewPassword { get; set; }

        [Required]
        [DataType(DataType.Password)]
        [DisplayName("确认新密码")]
        public string ConfirmPassword { get; set; }
    }

    public class LogOnModel
    {
        [Required]
        [DisplayName("用户名")]
        public string UserName { get; set; }

        [Required]
        [DataType(DataType.Password)]
        [DisplayName("密码")]
        public string Password { get; set; }

        [DisplayName("记住我?")]
        public bool RememberMe { get; set; }
    }

    [PropertiesMustMatch("Password", "ConfirmPassword", ErrorMessage = "密码和确认密码不匹配。")]
    public class RegisterModel
    {
        [Required]
        [DisplayName("用户名")]
        public string UserName { get; set; }

        [Required]
        [DataType(DataType.EmailAddress)]
        [DisplayName("电子邮件地址")]
        public string Email { get; set; }

        [Required]
        [ValidatePasswordLength]
        [DataType(DataType.Password)]
        [DisplayName("密码")]
        public string Password { get; set; }

        [Required]
        [DataType(DataType.Password)]
        [DisplayName("确认密码")]
        public string ConfirmPassword { get; set; }
    }

    public class UserInfoModel
    {
        [Required(ErrorMessage = "请填写您的联系电话")]
        [DisplayName("联系电话")]
        [DataType(DataType.PhoneNumber)]
        public string Phone { get; set; }

        [Required(ErrorMessage = "请填写您的联系地址")]
        [DisplayName("联系地址")]
        public string Address { get; set; }

        [Required(ErrorMessage = "请填写您的姓名")]
        [DisplayName("姓名")]
        public string Name { get; set; }

        [Required(ErrorMessage = "请选择您的性别")]
        [DisplayName("性别")]
        public bool? Gender { get; set; }
    }

    public class PendingUserModel
    {
        [ScaffoldColumn(false)]
        public System.Guid UserID { get; set; }

        [DisplayName("用户名")]
        public string UserName { get; set; }

        [DisplayName("电子邮件地址")]
        public string Email { get; set; }

        public UserInfoModel UserInfo { get; set; }
    }
}